Skip to content

Add monolithic fused packet allreduce kernel and Model::all_reduce_packet API#254

Merged
chhwang merged 10 commits into
mainfrom
pr-d-fused-packet-allreduce
Jun 10, 2026
Merged

Add monolithic fused packet allreduce kernel and Model::all_reduce_packet API#254
chhwang merged 10 commits into
mainfrom
pr-d-fused-packet-allreduce

Conversation

@chhwang

@chhwang chhwang commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Add monolithic fused packet allreduce kernel and Model::all_reduce_packet API

Port mscclpp's allreducePacket kernel into ARK as a single device
function (allreduce_packet_fused in comm.h) that fuses the three
phases — scatter, reduce, broadcast — into one kernel, synchronized by
LL packet flags instead of cross-block barriers.

Changes (10 files, +402 lines):

  • ark/include/kernels/comm.h: allreduce_packet_fused<> device
    function (scatter → reduce → broadcast, ~131 lines).
  • ark/ops/ops_communication.{hpp,cpp}: ModelOpAllReducePacketFused
    class with impl_name, impl_args, default_config. Tuning
    mirrors mscclpp's block/thread heuristics.
  • ark/model/model_op.cpp: register AllReducePacketFused.
  • ark/ops/ops_all_reduce.cpp: Model::all_reduce_packet — allocates
    scratch, creates peer refs, emits the fused op.
  • ark/include/ark/model.hpp: declare all_reduce_packet.
  • ark/api/planner.cpp: stamp NumProcs into op Config, guarded by
    op type AllReducePacketFused.
  • ark/ops/ops_communication_test.cpp: fix send_recv_reduce test to
    compute NumTasks from tensor shape; add single-GPU model-level test
    for ModelOpAllReducePacketFused.
  • python/model_py.cpp, python/ark/ops.py: bind and wrap
    all_reduce_packet.

Replaces the 3-op decomposition (send_packet
recv_reduce_send_packetrecv_packet) that incurred per-phase
task-launch overhead and could not fuse across phases.

Known limitations:

  • Flag = 1 hardcoded; per-call flag rotation deferred.
  • NumProcs >= NPeers required; compact regime deferred.

ark-dev added 5 commits June 9, 2026 01:31
…pying input into a private buffer before the loop.
…ct buffer aliasing and copy input into a private tensor before the ring loop.
… UNITTEST_SKIP macro (trailing whitespace) to pass PR #253 linter CI.
…(trailing whitespace / misaligned backslash in UNITTEST_SKIP macro) to pass the linters check on PR #253.
…reducePacket CUDA kernel replacing the 3-op decomposition, including all_reduce_packet method stripped from P4.
@chhwang chhwang changed the title ark-dev: Port mscclpp fused packet allreduce into ARK: monolithic allreducePacket CUDA kernel replacing the 3-op decomposition, including all_reduce_packet method stripped from P4. Add monolithic fused packet allreduce kernel and Model::all_reduce_packet API Jun 9, 2026
Base automatically changed from pr-c-allreduce-inplace-fix to main June 10, 2026 03:56
chhwang and others added 3 commits June 10, 2026 04:08
# Conflicts:
#	ark/ops/ops_all_reduce_test.cpp
#	ark/ops/ops_test_common.cpp
#	ark/unittest/unittest_utils.h
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.73684% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.94%. Comparing base (75de9b4) to head (58c1823).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
ark/ops/ops_communication.cpp 94.54% 3 Missing ⚠️
ark/ops/ops_communication.hpp 0.00% 1 Missing ⚠️
python/ark/ops.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
+ Coverage   86.88%   86.94%   +0.06%     
==========================================
  Files         125      127       +2     
  Lines        6113     6088      -25     
==========================================
- Hits         5311     5293      -18     
+ Misses        802      795       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ark-dev added 2 commits June 10, 2026 07:51
…rmat violations in 9 files), then add real C++ or Python tests for uncovered fused-packet-allreduce paths to raise from 82.47% to ≥86.88%; do not lower the codecov target or add ignore entries.
…rmat violations in 9 files), then add real C++ or Python tests for uncovered fused-packet-allreduce paths to raise from 82.47% to ≥86.88%; do not lower the codecov target or add ignore entries.
@chhwang
chhwang merged commit 1cdc3ec into main Jun 10, 2026
10 of 11 checks passed
@chhwang
chhwang deleted the pr-d-fused-packet-allreduce branch June 10, 2026 09:21
chhwang pushed a commit that referenced this pull request Jun 10, 2026
…esolving any conflicts; cause: BEHIND base by 1 commit (PR #254 merge).
chhwang added a commit that referenced this pull request Jun 11, 2026
Sync pr-e-python-api with main after PR #254 merge

Merge `main` into `pr-e-python-api` to incorporate commit `1cdc3ec`
(fused packet allreduce kernel + `Model::all_reduce_packet` API from
PR #254). The branch was behind by 1 commit.

The merge resolved cleanly with no conflicts. `python/ark/ops.py`
auto-merged (both sides added code at different locations). 11 files
changed, all from PR #254 content. No new feature code added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant